/*
 * Powered By [pkuWx]
 * Web Site: http://www.wuxi.ss.pku.edu.cn
 * Since 2015 - 2015
 */

package cn.edu.pku.wxlib.usertobookborrow.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import cn.org.rapid_framework.util.DateConvertUtils;

import java.util.*;

import cn.edu.pku.wxlib.usertobookborrow.model.*;
import cn.edu.pku.wxlib.usertobookborrow.service.*;
import cn.edu.pku.wxlib.usertobookborrow.vo.query.*;

import javacommon.base.*;
import javacommon.util.*;
import javacommon.page.Page;

/**
 * @version 1.0
 * @since 1.0
 */


public class Usertobookborrow extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "Usertobookborrow";
	public static final String ALIAS_USER_TO_BOOK_BORROW_ID = "userToBookBorrowId";
	public static final String ALIAS_USER_ID = "userId";
	public static final String ALIAS_BOOK_SKUID = "bookSkuid";
	public static final String ALIAS_BORROW_TIME = "借书时间";
	public static final String ALIAS_RETURN_TIME = "归还时间";
	public static final String ALIAS_SHOULD_RETURN_TIME = "应还时间";
	public static final String ALIAS_STATE = "1在借，2续借，3已还，4欠款，5丢失";
	public static final String ALIAS_FINE = "fine";
	public static final String ALIAS_IS_RENEW = "1已完成，0未完成";
	
	//date formats
	public static final String FORMAT_BORROW_TIME = DATE_FORMAT;
	public static final String FORMAT_RETURN_TIME = DATE_FORMAT;
	public static final String FORMAT_SHOULD_RETURN_TIME = DATE_FORMAT;
	
	//columns START
    /** userToBookBorrowId       db_column: userToBookBorrowId */	
	
	private java.lang.Integer userToBookBorrowId;
    /** userId       db_column: userId */	
	@NotNull 
	private java.lang.Integer userId;
    /** bookSkuid       db_column: bookSKUId */	
	@NotNull 
	private java.lang.Integer bookSkuid;
    /** 借书时间       db_column: borrowTime */	
	@NotNull 
	private java.util.Date borrowTime;
    /** 归还时间       db_column: returnTime */	
	
	private java.util.Date returnTime;
    /** 应还时间       db_column: shouldReturnTime */	
	@NotNull 
	private java.util.Date shouldReturnTime;
    /** 1在借，2续借，3已还，4欠款，5丢失 db_column: state */	
	
	private java.lang.Integer state;
    /** fine       db_column: fine */	
	
	private java.lang.Double fine;
    /** 1已完成，0未完成       db_column: isRenew */	
	
	private java.lang.Integer isRenew;
	//columns END

	public Usertobookborrow(){
	}

	public Usertobookborrow(
		java.lang.Integer userToBookBorrowId
	){
		this.userToBookBorrowId = userToBookBorrowId;
	}

	public void setUserToBookBorrowId(java.lang.Integer value) {
		this.userToBookBorrowId = value;
	}
	
	public java.lang.Integer getUserToBookBorrowId() {
		return this.userToBookBorrowId;
	}
	public void setUserId(java.lang.Integer value) {
		this.userId = value;
	}
	
	public java.lang.Integer getUserId() {
		return this.userId;
	}
	public void setBookSkuid(java.lang.Integer value) {
		this.bookSkuid = value;
	}
	
	public java.lang.Integer getBookSkuid() {
		return this.bookSkuid;
	}
	public String getBorrowTimeString() {
		return DateConvertUtils.format(getBorrowTime(), FORMAT_BORROW_TIME);
	}
	public void setBorrowTimeString(String value) {
		setBorrowTime(DateConvertUtils.parse(value, FORMAT_BORROW_TIME,java.util.Date.class));
	}
	
	public void setBorrowTime(java.util.Date value) {
		this.borrowTime = value;
	}
	
	public java.util.Date getBorrowTime() {
		return this.borrowTime;
	}
	public String getReturnTimeString() {
		return DateConvertUtils.format(getReturnTime(), FORMAT_RETURN_TIME);
	}
	public void setReturnTimeString(String value) {
		setReturnTime(DateConvertUtils.parse(value, FORMAT_RETURN_TIME,java.util.Date.class));
	}
	
	public void setReturnTime(java.util.Date value) {
		this.returnTime = value;
	}
	
	public java.util.Date getReturnTime() {
		return this.returnTime;
	}
	public String getShouldReturnTimeString() {
		return DateConvertUtils.format(getShouldReturnTime(), FORMAT_SHOULD_RETURN_TIME);
	}
	public void setShouldReturnTimeString(String value) {
		setShouldReturnTime(DateConvertUtils.parse(value, FORMAT_SHOULD_RETURN_TIME,java.util.Date.class));
	}
	
	public void setShouldReturnTime(java.util.Date value) {
		this.shouldReturnTime = value;
	}
	
	public java.util.Date getShouldReturnTime() {
		return this.shouldReturnTime;
	}
	public void setState(java.lang.Integer value) {
		this.state = value;
	}
	
	public java.lang.Integer getState() {
		return this.state;
	}
	public void setFine(java.lang.Double value) {
		this.fine = value;
	}
	
	public java.lang.Double getFine() {
		return this.fine;
	}
	public void setIsRenew(java.lang.Integer value) {
		this.isRenew = value;
	}
	
	public java.lang.Integer getIsRenew() {
		return this.isRenew;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("UserToBookBorrowId",getUserToBookBorrowId())
			.append("UserId",getUserId())
			.append("BookSkuid",getBookSkuid())
			.append("BorrowTime",getBorrowTime())
			.append("ReturnTime",getReturnTime())
			.append("ShouldReturnTime",getShouldReturnTime())
			.append("State",getState())
			.append("Fine",getFine())
			.append("IsRenew",getIsRenew())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getUserToBookBorrowId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Usertobookborrow == false) return false;
		if(this == obj) return true;
		Usertobookborrow other = (Usertobookborrow)obj;
		return new EqualsBuilder()
			.append(getUserToBookBorrowId(),other.getUserToBookBorrowId())
			.isEquals();
	}
}

